package com.gao.alg.geek;

public class MaxArea2 {

    public int maxArea(int[] height) {

        int maxArea = 0;
        for (int i = 0,j=height.length-1; i < j; ) {
            int h = height[i];
            int w = j-i;
            if(height[i]> height[j]){
                h = height[j];
                j--;
            }else {
                i++;
            }
            maxArea = Math.max(maxArea,h*w);
        }
        return maxArea;
    }
}
